module.exports = async (fastify, opts) => {
  fastify.post(
    '/',
    {
      schema: {
        body: {
          coverage: { type: 'integer' },
          location: {
            type: 'object',
            properties: {
              coordinates: { type: 'array', items: { type: 'number' } },
            },
          },
        },
      },
    },
    async (request, reply) => {
      const data = await fastify.invokeCloudFunction('upsert-screen', {
        ...request.body,
      })
      reply.send(data)
    }
  )
}
